# Author    :Dun_Hz
# Time      :2024/3/17 15:11
# 活动安排问题
activities = [(3,5),(1,4),(0,6),(3,8),(5,7),(6,10),(5,9),(8,11),(2,13),(8,12)]
# 保证活动是按照结束时间排好序的
activities = sorted(activities,key=lambda x:x[1])
print(activities)
def activity_selection(a):
    res = [a[0]]
    for i in range(1,len(a)):
        if a[i][0]>= res[-1][1]:
            res.append(a[i])

    return res
print(activity_selection(activities))

